<template>
  <el-table
    class="nil-thin-table"
    v-loading="loading"
    element-loading-text="正在拼命加载中..."
    :data="data"
    style="width: 100%"
    :stripe="stripe"
    :border="border"
  >
    <el-table-column
      v-for="(column, index) in columns"
      :key="index"
      :type="column.type"
      :prop="column.prop"
      :label="column.label"
      :width="column.width"
      :fixed="column.fixed"
    >
      <template #default="{ row }" v-if="!column.type">
        <slot :name="column.prop" :row="row">
          <span v-if="column.formatter">{{
            formatter(column.prop, row[column.prop])
          }}</span>
          <span v-else>{{ row[column.prop] }}</span>
        </slot>
      </template>
    </el-table-column>
  </el-table>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import { thinTableProps } from "./extra";

export default defineComponent({
  name: "NilThinTable",
  props: thinTableProps,
  setup() {
    return {};
  },
});
</script>
